<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'upload.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
	<s:form action="upload.action" theme="simple"
		enctype="multipart/form-data" method="post">
		<table>
			<tr>
				<td>请选择要上传的文件</td>
				<td id="more">
					<input type="text" size="20" name="upfile" id="upfile" > 
					<input type="button" value="浏览" onclick="path.click()"> 
					<s:file name="file" multiple="true"
							id="path" style="display:none" onchange="upfile.value=this.value" ></s:file>
					<!-- <input type="button" value="添加多个" onclick=addMore(); > -->
				</td>
			</tr>
			<tr>
				<td colspan="2" align="right">
					<s:submit value="确定" class="button white"  id="submit"></s:submit>
					<s:reset value="重置" class="button white" id="reset"></s:reset>
				</td>
			</tr>
		</table>
	</s:form>
	
<script type="text/javascript">
var submit = document.getElementById("submit");
var filepath = document.getElementById("path");

submit.onclick=function(){
	if(filepath.value==""){
		alert("您还没有上传文件");
		return false;
	}
	return true;
}

/*
	function addMore() {
		var td = document.getElementById("more");
		var br = document.createElement("br");
		var input = document.createElement("input");
		var button = document.createElement("input");
		var span = document.createElement("span");
		input.type = "file";
		input.name = "file";
		input.multiple="true";
		button.type = "button";
		button.value = "删除";

		button.onclick = function() {
			td.removeChild(br);
			td.removeChild(input);
			td.removeChild(button);
			td.removeChild(span);
		}
		input.onchange = function() {
			clearTooltip(this);
			checkExt(this);
		}
		td.appendChild(br);
		td.appendChild(input);
		td.appendChild(span);
		td.appendChild(button);

	}*/
</script>
</body>
</html>
